Page({
  data: {
    notices: [
      { id: 1, content: '本周六放假一天' },
      { id: 2, content: '下周一正常上课' }
    ],
    newNotice: ''
  },
  onNoticeInput(e) {
    this.setData({ newNotice: e.detail.value });
  },
  addNotice() {
    const { newNotice, notices } = this.data;
    if (!newNotice) return;
    notices.unshift({ id: notices.length + 1, content: newNotice });
    this.setData({ notices, newNotice: '' });
  }
}); 